<?php
require_once 'appliance/Light.php';
require_once 'command/Command.php';
require_once 'command/LightOn.php';
require_once 'command/LightOff.php';
require_once 'control/SimpleControl.php';

//灯 接受者
$light   = new Light();
//开灯 命令
$lightOn = new LightOn($light);
$lightOff = new LightOff($light);
//简单控制器
$control = new SimpleControl();
//遥控器上不同的键对应的不同命令
$control->setCommand(0, $lightOn);
$control->setCommand(1, $lightOff);
$control->setCommand(2, $lightOff);
$control->setCommand(3, $lightOff);
//按下开灯键
$control->pressButton(0);
$control->pressButton(1);